const App = {
  mixins: [Query], //配置文件，路径/utils/mixins.js
  data() {
    return {
      z: [],
      // statistics: {
      //   partyCongress: {
      //     // 初始化为12个0的数组
      //     total: Array(12).fill(0),
      //     completed: Array(12).fill(0),
      //   },
      // },
      statistics: {
        total: { completed: 0, total: 0 }, // 全部开展情况
        partyCongress: { completed: 0, total: 0 }, // 党员大会
        partyCommittee: { completed: 0, total: 0 }, // 支委会
        partyGroup: { completed: 0, total: 0 }, // 党小组会
        partyLecture: { completed: 0, total: 0 }, // 党课
        shuanglianxi: { completed: 0, total: 0 },
        zhutidangri: { completed: 0, total: 0 },
        zhiyuanfuwu: { completed: 0, total: 0 },
      },
      menuItems: [
        { label: "党员大会", value: "党员大会" },
        { label: "支委会", value: "支委会" },
        { label: "党小组会", value: "党小组会" },
        { label: "党课", value: "党课" },
        { label: "双联系双报到", value: "双联系双报到" },
        { label: "主题党日", value: "主题党日" },
        { label: "民主生活会", value: "民主生活会" },
        { label: "组织生活会", value: "组织生活会" },
      ],
      monthColors: [
        "#e85858",
        "#f09ab2",
        "#9fbf6a",
        "#6fbbc8",
        "#a79ecb",
        "#f7ac69",
        "#ea5859",
        "#f19ab2",
        "#9fbf6a",
        "#6fbbc7",
        "#a79ecb",
        "#f7ac69",
      ],
      dialogTableVisible: false,
      currentTreeNodeId: "", // 新增：存储当前选中的树节点ID
      Total: "",
      currentPage: 1, //当前页码
      pageSize: 10, // 每页记录数
      totalMembers: 111, //总人数
      fullMembers: 11, //正式党员
      probationaryMembers: 1, //预备党员
      input: "", //输入框
      options: [],
      treeData: [], //树的数据
      originalTreeData: [], //原始树的数据
      originalTableData: [], // 原始表格的数据
      columns: [], //表格的列
      hy: [],
      loading: false, //表数据的懒加载
      checkedFields: [], //选中的字段
      isDataReady: false,
      Tabletdata: [], //表格的数据
      fields: [], //字段列表
      value: "",
      QR_code: false,
      qr: null, // 二维码生成器实例
      currentActivity: null, // 当前活动
      szText: "",
      year: new Date().getFullYear(),
      month: "",
      page: {
        PageNumber: 1,
        RowAmount: 10,
        Condition: window.btoa(
          unescape(encodeURIComponent("%%,%%,%%,%%,2025"))
        ),
        istype: this.istype,
      },
    };
  },
  mounted() {
    console.log(this.istype);
    (this.page.Condition = window.btoa(
      unescape(
        encodeURIComponent("%%,%%,%" + this.istype + "%,%%," + this.year)
      )
    )),
      this.Treedata();
    // this.getData();
    this.Sql();
    $.ajax({
      headers: requestHeaders(),
      url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
      method: "post",
      data: {
        SQLSerialNumber: "t_count_Activity",
        Condition: window.btoa(unescape(encodeURIComponent(this.istype))) ,
        ExtensionCondition: "",
      },
      success: (data) => {
        let obj = {};
        for (let i = 0; i < 12; i++) {
          const element = data.filter(x=> new Date(x.Month).getMonth() == i)[0];
          if (element) {
            obj[i + 1] = element
          } else {
            obj[i + 1] = {
              total:0,
              Frequency:  0
            }
          }
          
        }
        this.z = obj
      },
      complete: (XMLHttpRequest) => {
        requestPretreatment(XMLHttpRequest);
      },
    })
  },
  computed: {
    istype() {
      const currentIframe = window.frameElement;
      let frameId;
      if (currentIframe) {
        frameId = currentIframe.getAttribute("data-frameid");
      }
      switch (frameId) {
        case "BSML00000000123":
          return "党员大会";
        case "BSML00000000124":
          return "支委会";
        case "BSML00000000125":
          return "党小组会";
        case "BSML00000000126":
          return "党课";
        case "BSML00000000127":
          return "双联系双报到";
        case "BSML00000000128":
          return "主题党日";
        case "BSML00000000129":
          return "志愿服务";
        case "BSML00000000172":
          return "民主生活会";
        case "BSML00000000173":
          return "组织生活会";
        default:
          return "党员大会";
      }
    },
    isStatus() {
      return function (row) {
        if (+new Date(row.Activity_Datetime) > +new Date()) {
          return { label: '未开始', value: 'primary', color: '#409EFF' };
        } else if (row.Activity_EndDatetime == '' && +new Date(row.Activity_Datetime) < +new Date()) {
          return { label: '进行中', value: 'warning', color: '#E6A23C' };
        } else if (row.Activity_EndDatetime != '' && +new Date(row.Activity_Datetime) < +new Date() && +new Date(row.Activity_EndDatetime) > +new Date()) {
          return { label: '进行中', value: 'warning', color: '#E6A23C' };
        } else if (+new Date(row.Activity_EndDatetime) < +new Date()) {
          return { label: '已结束', value: 'info', color: '#909399' }
        } else {
          return { label: '', value: '', color: '' }
        }
      }
    },
    // 计算属性，返回选中的字段
    isAllChecked() {
      return this.checkedFields.length === this.fields.length;
    },
    isButtonEnabled(row) {
      return function (row) {
        if (row.Recorder_SerialNumber == "") return true;
      };
    },
  },
  methods: {
    xinwenjilu(row) {
      window.location.href = './news.html?nodeKey=' + row.Party_Organization_Activity_SerialNumber
    },
    getMonthData(month) {
      // 在z数组中查找匹配的月份数据
      const monthData = this.z.find((item) => item.month === month);

      // 返回找到的数据或默认值
      return monthData || { opened: 0, total: 0 };
    },
    getData() {
      const _this = this;
     
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
        method: "post",
        data: {
          SQLSerialNumber: "f_activity_type_count",
          Condition: "",
          ExtensionCondition: "",
        },
        success: (data) => {
          console.log(data);

          // console.log(this.statistics);
          _this.Sql();
          // data.forEach((item) => {
          //   switch (item.Activity_Type) {
          //     case "全部开展情况":
          //       this.statistics.total.total = item.total;
          //       this.statistics.total.completed = item.total1;
          //       break;
          //     case "党员大会":
          //       this.statistics.partyCongress.total = item.total;
          //       this.statistics.partyCongress.completed = item.total1;
          //       break;
          //     case "党委会":
          //       this.statistics.partyCommittee.total = item.total;
          //       this.statistics.partyCommittee.completed = item.total1;
          //       break;
          //     case "党小组会":
          //       this.statistics.partyGroup.total = item.total;
          //       this.statistics.partyGroup.completed = item.total1;
          //       break;
          //     case "党课":
          //       this.statistics.partyLecture.total = item.total;
          //       this.statistics.partyLecture.completed = item.total1;
          //       break;
          //     case "双联系双报道":
          //       this.statistics.shuanglianxi.total = item.total;
          //       this.statistics.shuanglianxi.completed = item.total1;
          //       break;
          //     case "主题党日":
          //       this.statistics.zhutidangri.total = item.total;
          //       this.statistics.zhutidangri.completed = item.total1;
          //       break;
          //     case "志愿服务":
          //       this.statistics.zhiyuanfuwu.total = item.total;
          //       this.statistics.zhiyuanfuwu.completed = item.total1;
          //       break;
          //   }
          // });
        },
        complete: (XMLHttpRequest) => {
          requestPretreatment(XMLHttpRequest);
        },
      });
    },

    Sql() {
      console.log(this.istype);
      // return;
      const _this = this;
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
        method: "post",
        data: {
          SQLSerialNumber: "y_Months",
          Condition: "",
          ExtensionCondition: "",
        },
        success: function (Result) {
          // 1. 筛选对应会议类型（如“党员大会”）
          const filteredActivities = Result.filter(
            (item) => item.Activity_Type === _this.istype
          );

          // 2. 初始化12个月的空数据
          const monthlyData = new Array(12).fill().map((_, index) => ({
            month: index + 1,
            opened: 0,
            total: 0,
          }));

          // 3. 填充后端数据到对应月份
          filteredActivities.forEach((item) => {
            const month = Number(item.Month);
            if (month >= 1 && month <= 12) {
              const index = month - 1;
              monthlyData[index].opened = Number(item.Opened_Times) || 0;
              monthlyData[index].total = Number(item.Total_Times) || 0;
            }
          });

          // 4. 更新视图数据
          _this.statistics.partyCongress = {
            months: monthlyData,
          };

          console.log("按月数据：", monthlyData);
          _this.z = monthlyData;
          console.log(_this.z);

          return;
          // 统计数据对象
          const statistics = {
            partyCongress: {
              completed: monthlyData.map((item) => item.opened),
              total: monthlyData.map((item) => item.total),
            },
          };

          // 获取value1元素
          const value1Element = document.getElementById("value1");

          // 清空元素内容
          value1Element.innerHTML = "";
          // 创建数据显示
          monthlyData.forEach((month, index) => {
            // const monthItem = document.createElement("div");
            // monthItem.className = "month-item";
            // 完成情况文本
            const completionText = document.createElement("div");
            completionText.textContent = `${month.opened}/${month.total}`;
            console.log(completionText);
          });
          // 将文本添加到元素中
          // value1Elements[index].appendChild(completionText);
          return;
          // // 使用filter方法筛选出Activity_Type为"党员大会"的对象
          // const partyCongressActivities = Result.filter(
          //   (item) => item.Activity_Type === "党员大会"
          // );
          // // 打印筛选结果
          // console.log(partyCongressActivities);

          Result.forEach((item) => {
            console.log(item);

            // const monthIndex = item.Month - 1; // 转换为0-11的索引
            // console.log(monthIndex);
            // if (monthIndex >= 0 && monthIndex < 12) {
            //   // 依次赋值而不是累加
            //   _this.statistics.partyCongress.total[monthIndex] =
            //     item.Total_Times;
            //   _this.statistics.partyCongress.completed[monthIndex] =
            //     item.Opened_Times;

            //   console.log(`已为${item.Month}月赋值: `, {
            //     total: item.Total_Times,
            //     completed: item.Opened_Times,
            //   }
            // );
            // } else {
            //   console.warn(`无效的月份: ${item.Month}`);
            // }
            switch (item.Activity_Type) {
              case "党员大会":
                _this.statistics.partyCongress.total = item.Total_Times;
                _this.statistics.partyCongress.completed = item.Opened_Times;
                break;
              case "党委会":
                _this.statistics.partyCommittee.total = item.Total_Times;
                _this.statistics.partyCommittee.completed = item.Opened_Times;
                break;
              case "党小组会":
                _this.statistics.partyGroup.total = item.Total_Times;
                _this.statistics.partyGroup.completed = item.Opened_Times;
                break;
              case "党课":
                _this.statistics.partyLecture.total = item.Total_Times;
                _this.statistics.partyLecture.completed = item.Opened_Times;
                break;
              case "双联系双报道":
                _this.statistics.shuanglianxi.total = item.Total_Times;
                _this.statistics.shuanglianxi.completed = item.Opened_Times;
                break;
              case "主题党日":
                _this.statistics.zhutidangri.total = item.Total_Times;
                _this.statistics.zhutidangri.completed = item.Opened_Times;
                break;
              case "志愿服务":
                _this.statistics.zhiyuanfuwu.total = item.Total_Times;
                _this.statistics.zhiyuanfuwu.completed = item.Opened_Times;
                break;
            }
          });
          console.log(_this.statistics);
        },
        complete: (XMLHttpRequest) => {
          requestPretreatment(XMLHttpRequest);
        },
        dataType: "json",
      });
    },
    //全员签出状态
    handleCommand(command) {
      console.log(command);
      sessionStorage.setItem("command", command);
    },
    //查询按钮
    check() {
      this.page.Condition = window.btoa(
        unescape(
          encodeURIComponent(
            "%%,%" +
            this.input +
            "%,%" +
            this.istype +
            "%,%" +
            this.month +
            "%," +
            this.year
          )
        )
      );
      this.postgetList(this.page); // 调用查询方法
    },
    handleCardClick(i) {
      // const szText = event.currentTarget.querySelector(".sz").textContent.trim();
      // if (szText != '全部开展情况') {
      //   this.szText = szText;
      // } else {
      //   this.szText = ''
      // }
      if (this.month == i) {
        this.month = "";
      } else {
        this.month = i;
      }
      this.page.Condition = window.btoa(
        unescape(
          encodeURIComponent(
            "%%,%" +
            this.input +
            "%,%" +
            this.istype +
            "%,%" +
            this.month +
            "%," +
            this.year
          )
        )
      );
      this.postgetList(this.page); // 调用查询方法
    },
    qianc(index, row) {
      console.log(row.Party_Organization_Activity_SerialNumber);
      ElMessageBox.confirm("是否全员签出？", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          $.ajax({
            headers: requestHeaders(),
            url: `${mh}/generalBusiness/generalQueryByTableNameWithOriginal`,
            method: "post",
            data: {
              Data: "party_organization_activities_members",
              Condition: `Row_Status='0' AND Check_Out_Datetime = '' AND Party_Organization_Activity_SerialNumber='${row.Party_Organization_Activity_SerialNumber}'`,
            },
            success: (data) => {
              let Check_Out_Datetime = getYMDHMSDate();
              data.forEach((item) => {
                item.Check_Out_Datetime = Check_Out_Datetime;
              });
              let lJSONObject_DataSet = {
                Modify: { party_organization_activities_members: data },
              };
              let Operation_Main = JSON.stringify(
                deepClone(lJSONObject_DataSet)
              );
              if (!lJSONObject_DataSet["Add"]) {
                lJSONObject_DataSet["Add"] = new Object();
              }
              lJSONObject_DataSet["Add"]["base_operation_log"] = [
                {
                  Operation_Type: "0",
                  Operation_Path: this.relativePath,
                  Operation_Main,
                  Operation_Interface: "generalSaveByRequestBody",
                  Operation_IP: getIpAddress(),
                },
              ];
              submitSave(lJSONObject_DataSet, (res) => {
                if (res.Status == "success") {
                  this.postgetList(this.page);
                  this.$message({
                    type: "success",
                    message: "操作成功",
                  });
                }
              });
              // $.ajax({
              //   headers: requestHeaders(),
              //   url: `${mh}/generalBusiness/generalSave`,
              //   method: "post",
              //   data: {
              //     Data: JSON.stringify(lJSONObject_DataSet),
              //   },
              //   success: (res) => {
              //     if (res.Status == "success") {
              //       this.postgetList(this.page);
              //       this.$message({
              //         type: "success",
              //         message: "操作成功",
              //       });
              //     }
              //   },
              //   complete: (XMLHttpRequest) => {
              //     requestPretreatment(XMLHttpRequest);
              //   },
              // });
            },
            complete: (XMLHttpRequest) => {
              requestPretreatment(XMLHttpRequest);
            },
          });
        })
        .catch(() => { });
    },
    handletx(row) {
      this.$confirm("是否向参与活动成员发送消息提醒?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        $.ajax({
          headers: requestHeaders(),
          url: `${mh}/requestForward/requestForward?RequestURL=${encodeURIComponent(`/wx/mp/sendActivityMessage?Member=&Data=${row.Party_Organization_Activity_SerialNumber}`)}`,
          type: "get",
          dataType: "json",
          async: false,
          complete: function (XMLHttpRequest) {
            requestPretreatment(XMLHttpRequest);
          },
          success: (res) => {
            console.log(res);
            this.$message({
              type: "success",
              message: "操作成功",
            });
          },
        })

        // $.ajax({
        //   url: `${y}/sendMessageSendMessage`,
        //   method: "GET",
        //   data: {
        //     Data: row.Party_Organization_Activity_SerialNumber,
        //   },
        //   success: (res) => {
        //     if (res.Status == "success") {
        //       this.$message({
        //         type: "success",
        //         message: "操作成功",
        //       });
        //     }
        //   },
        //   complete: (XMLHttpRequest) => {
        //     requestPretreatment(XMLHttpRequest);
        //   },
        // });
      })
        .catch(() => { });
    },
    handlexq(index, row) {
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/generalBusiness/generalQueryByTableName`,
        method: "post",
        data: {
          Data: "party_three_app_account_manage", //表名
          Condition: "Row_Status='0'",
        },
        success: (data) => {
          console.log(data);
          console.log(data[0].AppID);
          sessionStorage.setItem("AppID", data[0].AppID);
          this.wha(data[0].AppID, row);
        },
        complete: (XMLHttpRequest) => {
          requestPretreatment(XMLHttpRequest);
        },
      });
      // return;
    },
    wha(AppID, row) {
      console.log(AppID, row);
      // return;
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/weChatMiniprogram/getUrlLink`,
        // url: `http://10.1.0.59:8084/weChatMiniprogram/getUrlLink`,
        method: "get",
        data: {
          AppID: AppID,
          Path: "pages/index/signIn/signIn",
          ExpireType: "1",
          Interval: "1",
          Query: `nodeKey=${row.Party_Organization_Activity_SerialNumber}`,
          Env_Version: "trial",
        },
        success: (data) => {
          data.url = `${data.url_link}?${row.Party_Organization_Activity_SerialNumber}`;
          console.log(data);
          if (data.errmsg == "ok") {
            this.erw(data.url, row);
          }
        },
        complete: (XMLHttpRequest) => {
          requestPretreatment(XMLHttpRequest);
        },
      });
    },
    erw(arg_url, row) {
      this.currentActivity = row;
      this.QR_code = true;

      // 先验证URL有效性
      if (!this.validateURL(arg_url)) {
        this.$message.error("URL格式错误，无法生成二维码");
        return;
      }

      this.$nextTick(() => {
        const qrElementId = `qr-${row.Party_Organization_Activity_SerialNumber}`;
        const qrElement = document.getElementById(qrElementId);

        // 清空原有二维码（如果存在）
        if (qrElement) qrElement.innerHTML = "";

        // 优化后的二维码生成参数
        new QRious({
          element: qrElement,
          value: arg_url,
          size: 256, // 增大尺寸到256px
          level: "H", // 最高容错率（可恢复30%损坏）
          background: "#ffffff", // 明确背景色
          foreground: "#000000", // 明确前景色
          quietZone: 4, // 增加空白边距
        });

        // 生成成功后添加动画效果
        if (qrElement) {
          qrElement.style.transition = "all 0.5s ease";
          qrElement.style.opacity = "0";
          setTimeout(() => {
            qrElement.style.opacity = "1";
          }, 100);
        }
      });

      // this.currentActivity = row;
      // this.QR_code = true;
      // this.$nextTick(() => {
      //   const encodedSerial = encodeURIComponent(
      //     row.Party_Organization_Activity_SerialNumber
      //   );
      //   // const url = `http://10.1.0.150:5503/view/party_organization_activities/particulars.html?serial=${encodedSerial}`;
      //   const url = arg_url;

      //   new QRious({
      //     element: document.getElementById(
      //       `qr-${row.Party_Organization_Activity_SerialNumber}`
      //     ),
      //     value: url,
      //     size: 200,
      //   });
      // });
    },
    huir(index, row) {
      window.location.href =
        "./show.html?Party_Organization_Activity_SerialNumber=" +
        row.Party_Organization_Activity_SerialNumber;
    },
    // 在methods中添加新方法
    regenerateQRCode() {
      if (!this.currentActivity || !this.currentActivity.url) {
        this.$message.warning("当前活动信息不完整，无法重新生成二维码");
        return;
      }

      // 显示加载状态
      this.loading = true;

      // 模拟重新获取URL（实际应用中可能需要从服务器重新获取）
      setTimeout(() => {
        this.erw(this.currentActivity.url, this.currentActivity);
        this.$message.success("二维码已重新生成");
        this.loading = false;
      }, 500);
    },
    // 优化openQRDialog方法（如果有）
    openQRDialog(activity) {
      this.currentActivity = activity;
      // 确保URL正确编码
      this.erw(activity.url, activity);
      this.QR_code = true;
    },
    // URL有效性验证方法
    validateURL(url) {
      try {
        new URL(url);
        return true;
      } catch (e) {
        console.error("URL验证失败:", e);
        return false;
      }
    },
    //参会人员
    canh(index, row) {
      console.log(index, row);
      window.location.href =
        "./party_organization_activities_members.html?Party_Organization_Activity_SerialNumber=" +
        row.Party_Organization_Activity_SerialNumber;
    },
    //标签页点击事件
    handleClick(tab, event) {
      console.log(tab, event);
    },
    //树的数据 查询树的接口
    Treedata() {
      const _this = this;
      $.ajax({
        headers: requestHeaders(),
        url: mh + "/generalBusiness/getPartyOrganizationTree",
        method: "get",
        success: function (data) {
          console.log(data);
          //赋值到树上
          _this.treeData = data;
          // 使用深拷贝赋值 originalTreeData
          _this.originalTreeData = JSON.parse(JSON.stringify(data));
        },
        complete: (XMLHttpRequest) => {
          requestPretreatment(XMLHttpRequest);
        },
        dataType: "json",
      });
    },

    //重置按钮
    reset() {
      // 这里可以根据你的实际需求修改逻辑
      window.location.reload();
      console.log("重置操作");
    },
    //过滤树的数据
    filterTreeData(data, searchText) {
      return data.filter((item) => {
        if (item.label.includes(searchText)) {
          return true;
        }
        if (item.children) {
          const filteredChildren = this.filterTreeData(
            item.children,
            searchText
          );
          if (filteredChildren.length > 0) {
            item.children = filteredChildren;
            return true;
          }
        }
        return false;
      });
    },
    //添加按钮
    personalAdd() {
      sessionStorage.setItem("addType", this.istype);
      window.location.href = "./Add.html?action=Add";
    },
    //编辑按钮
    handleEdit(index, row) {
      let { primary_key } = JSON.parse(
        document.getElementById("table").getAttribute("data-options")
      );
      // let a = "Edit";
      // sessionStorage.setItem("type", a);
      // let key = sessionStorage.getItem("key");
      // console.log(key);
      // //获取觉组活动参与人员流水号存起来
      // sessionStorage.setItem("rowkey", row[key]);
      //获取活动类型存起来，传到添加页的活动标题
      sessionStorage.setItem("addType", row.Activity_Type);

      window.location.href =
        "./Add.html?action=Modify&nodeKey=" + row[primary_key];
    },
    handleEdit1(index, row) {
      let { primary_key } = JSON.parse(
        document.getElementById("table").getAttribute("data-options")
      );
      sessionStorage.setItem("addType", row.Activity_Type);

      window.location.href =
        "./Add1.html?action=Modify&nodeKey=" + row[primary_key];
    },
    handleEdit2(index, row) {
      let { primary_key } = JSON.parse(
        document.getElementById("table").getAttribute("data-options")
      );
      sessionStorage.setItem("addType", row.Activity_Type);

      window.location.href =
        "./Add1.html?action=Modify&type=1&nodeKey=" + row[primary_key];
    },
    xinwen(row) {
      let { primary_key } = JSON.parse(
        document.getElementById("table").getAttribute("data-options")
      );
      window.location.href =
        "../news_videos_files/news/add.html?action=Add&Party_Organization_Activity_SerialNumber=" +
        row[primary_key] +
        "&addType=" +
        this.istype + '&Party_Organization_SerialNumber=' + row.Party_Organization_SerialNumber;
    },
    // 弹窗全选
    handleAllChecked(val) {
      console.log(val);
      console.log(val);
      let a; // 提前声明变量 a
      if (val === false) {
        console.log(this.fields);
        a = this.fields.filter((item) => {
          return item.COLUMN_KEY == "PRI";
        });
        console.log(a);
      } else {
        a = [...this.fields]; // 当 val 为 true 时，给 a 赋值为 props.fields 的副本
      }
      // 使用 emit 更新 checkedFields
      this.checkedFields = a;
    },
    saveFields() {
      const selectedFields = this.fields.filter((item) => {
        return this.checkedFields.some(
          (cItem) => cItem && cItem.COLUMN_NAME === item.COLUMN_NAME
        );
      });
      console.log("选中的字段:", selectedFields);
      // 更新 columns
      this.columns = selectedFields;
      this.showDialog = false;
    },
    //树的点击事件
    handleNodeClick(data) {
      let arr = [];
      if (data.children) {
        this.Organization(data.children, arr);
      }
      let str = "";
      [data.Party_Organization_SerialNumber, ...arr].forEach((item) => {
        if (str) {
          str +=
            "\r\nOR party_organization_activities.Party_Organization_SerialNumber='" +
            item +
            "'";
        } else {
          str =
            "\r\nparty_organization_activities.Party_Organization_SerialNumber='" +
            item +
            "'";
        }
      });
      if (str) {
        str = "AND (" + str + ")";
      }
      this.page.ExtensionCondition = window.btoa(
        unescape(encodeURIComponent(str))
      );
      // this.page.Condition = window.btoa(unescape( encodeURIComponent("%"+data.Party_Organization_SerialNumber+"%,%"+this.input + "%,%" + this.istype + "%,%" + this.month +"%," +  this.year )));
      this.postgetList(this.page); // 调用查询方法
    },
    Organization(data, arr) {
      data.forEach((item) => {
        arr.push(item.Party_Organization_SerialNumber);
        if (item.children && item.children.length > 0) {
          this.Organization(item.children, arr);
        }
      });
    },
    //显示字段弹窗
    handleOpenDialog() {
      this.showDialog = true;
    },
  },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
const ElMessageBox = ElementPlus.ElMessageBox;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
